Path: blob/master/Part 8 - Deep Learning/Convolutional Neural Networks/[Python] Convolutional Neural Networks.ipynb
1009 views
Convolutional Neural Networks
Data Preprocessing is done manually.
In our case, we:
We created a dataset/ folder
Then created training_set/ and test_set/ subfolders inside dataset/ folder
Inside training_set/ and test_set/ subfolders we created cats/ and dogs/ subfolders
Then we have placed 4000 cat pictures index 1-4000 in dataset/training_set/cats
Then we have placed 4000 dog pictures index 1-4000 in dataset/training_set/dogs
Then we have placed 1000 cat pictures index 4001-5000 in dataset/test_set/cats
Then we have placed 1000 dog pictures index 4001-5000 in dataset/test_set/dogs
So now we have 4000 training examples for each class, and 1000 test examples for each class.
Our directory structure is something like this:
If you want a bigger dataset then go here: [kaggle] Dogs vs. Cats(Create an algorithm to distinguish dogs from cats)
Additional Note: Fitting CNN to the image takes a lot of time and processing power. It would be better if you use tensorflow-gpu. Alternatively you can use any cloud service to train your network on. I personally used FloydHub. There are other alternative too such as AWS, Google Cloud, Paperspace etc. I will link few of them below.